package com.grass.p019lv.view.svip;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.Constance;
import com.androidx.p013lv.base.bean.InventionBean;
import com.androidx.p013lv.base.bean.VideoBean;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.utils.LogUtils;
import com.androidx.p013lv.invention.OnInventionType;
import com.androidx.p013lv.invention.adapter.AdapterSvipVerticalNew;
import com.androidx.p013lv.player.view.BrushVideoPlayerNew;
import com.google.android.exoplayer2.SeekParameters;
import p000a.shuyu.p005a.builder.GSYVideoOptionBuilder;
import p000a.shuyu.p005a.listener.GSYSampleCallBack;
import p000a.shuyu.p005a.utils.OrientationUtils;
import p000a.shuyu.p005a.video.StandardGSYVideoPlayer;
import p031tv.danmaku.ijk.media.exo2.Exo2PlayerManager;

/* renamed from: com.grass.lv.view.svip.SvipOneViewNew */
public class SvipOneViewNew {
    AdapterSvipVerticalNew adapter;
    LinearLayout btn_more;
    private boolean clickLimit = true;
    Context context;
    String domain;
    Fragment fragment;
    InventionBean inventionBean;
    ImageView iv_cover;
    private long lastClickTime;
    OnInventionType onInventionType;
    private OrientationUtils orientationUtils;
    public BrushVideoPlayerNew player;
    int position;
    RecyclerView recycler;
    TextView tv_title;

    public SvipOneViewNew(View view, Fragment fragment2, String str, OnInventionType onInventionType2) {
        this.context = view.getContext();
        this.onInventionType = onInventionType2;
        this.domain = str;
        this.fragment = fragment2;
        this.recycler = (RecyclerView) view.findViewById(R.id.recycler);
        this.tv_title = (TextView) view.findViewById(R.id.tv_title);
        this.player = (BrushVideoPlayerNew) view.findViewById(R.id.play);
    }

    public void setView(InventionBean inventionBean2, int i) {
        this.inventionBean = inventionBean2;
        this.position = i;
        this.tv_title.setText(inventionBean2.getStationName());
        if (this.inventionBean.getVideoList().size() > 0) {
            setRecycler(this.inventionBean);
        }
        this.player.loadCoverImage(this.inventionBean.getVideoList().get(0).getCoverImg().get(0));
        final Activity activity = (Activity) this.context;
        OrientationUtils orientationUtils2 = new OrientationUtils(activity, this.player);
        this.orientationUtils = orientationUtils2;
        orientationUtils2.setEnable(false);
        new GSYVideoOptionBuilder().setRotateViewAuto(false).setLockLand(false).setAutoFullWithSize(false).setShowFullAnimation(false).setIsTouchWiget(false).setVideoAllCallBack(new GSYSampleCallBack() {
            /* class com.grass.p019lv.view.svip.SvipOneViewNew.C32341 */

            @Override // p000a.shuyu.p005a.listener.VideoAllCallBack, p000a.shuyu.p005a.listener.GSYSampleCallBack
            public void onAutoComplete(String str, Object... objArr) {
                if (SvipOneViewNew.this.player.getBottomContainer() != null && SvipOneViewNew.this.player.getBottomContainer().getVisibility() == 0) {
                    SvipOneViewNew.this.player.getBottomContainer().setVisibility(8);
                }
                if (SvipOneViewNew.this.player.isIfCurrentIsFullscreen()) {
                    SvipOneViewNew.this.player.getFullWindowPlayer().startPlayLogic();
                } else {
                    SvipOneViewNew.this.player.startPlayLogic();
                }
            }

            @Override // p000a.shuyu.p005a.listener.VideoAllCallBack, p000a.shuyu.p005a.listener.GSYSampleCallBack
            public void onPrepared(String str, Object... objArr) {
                super.onPrepared(str, objArr);
                try {
                    if (SvipOneViewNew.this.player.getGSYVideoManager().getPlayer() instanceof Exo2PlayerManager) {
                        ((Exo2PlayerManager) SvipOneViewNew.this.player.getGSYVideoManager().getPlayer()).setSeekParameter(SeekParameters.NEXT_SYNC);
                    }
                } catch (Exception unused) {
                    LogUtils.m63e("---->", "设置 seek 的临近帧");
                }
            }

            @Override // p000a.shuyu.p005a.listener.VideoAllCallBack, p000a.shuyu.p005a.listener.GSYSampleCallBack
            public void onQuitFullscreen(String str, Object... objArr) {
                super.onQuitFullscreen(str, objArr);
                if (SvipOneViewNew.this.orientationUtils != null) {
                    SvipOneViewNew.this.orientationUtils.backToProtVideo();
                }
                if (SvipOneViewNew.this.player.getCurrentState() == 6 && SvipOneViewNew.this.player.getBottomContainer().getVisibility() == 0) {
                    SvipOneViewNew.this.player.getBottomContainer().setVisibility(8);
                }
            }
        }).build((StandardGSYVideoPlayer) this.player);
        this.player.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
            /* class com.grass.p019lv.view.svip.SvipOneViewNew.View$OnClickListenerC32352 */

            public void onClick(View view) {
                SvipOneViewNew.this.orientationUtils.resolveByClick();
                SvipOneViewNew.this.player.startWindowFullscreen(activity, true, true);
            }
        });
        this.player.getBackButton().setOnClickListener(new View.OnClickListener() {
            /* class com.grass.p019lv.view.svip.SvipOneViewNew.View$OnClickListenerC32363 */

            public void onClick(View view) {
                if (SvipOneViewNew.this.orientationUtils != null) {
                    SvipOneViewNew.this.orientationUtils.backToProtVideo();
                }
            }
        });
    }

    /* access modifiers changed from: package-private */
    public void setRecycler(InventionBean inventionBean2) {
        if (this.adapter == null) {
            this.adapter = new AdapterSvipVerticalNew(this.fragment, this.domain);
            this.recycler.setLayoutManager(new LinearLayoutManager(this.context, 0, false));
            this.recycler.setAdapter(this.adapter);
            this.adapter.setOnItemClickListener(new AdapterSvipVerticalNew.OnItemClickListener() {
                /* class com.grass.p019lv.view.svip.SvipOneViewNew.C32374 */

                @Override // com.androidx.p013lv.invention.adapter.AdapterSvipVerticalNew.OnItemClickListener
                public void onItemClick(VideoBean videoBean) {
                    SvipOneViewNew.this.player.setVideoBean(videoBean);
                    SvipOneViewNew.this.player.startPlayLogic();
                }

                @Override // com.androidx.p013lv.invention.adapter.AdapterSvipVerticalNew.OnItemClickListener
                public void onItemDoubleClick(VideoBean videoBean) {
                    ARouter.getInstance().build(Constance.VIDEO_PLAY_ACTIVITY).withSerializable(Key.VIDEO_ID, Integer.valueOf(videoBean.getVideoId())).navigation();
                }
            });
        }
        this.adapter.setData(inventionBean2.getVideoList());
    }

    /* access modifiers changed from: protected */
    public boolean isOnClick() {
        long currentTimeMillis = System.currentTimeMillis();
        long j = currentTimeMillis - this.lastClickTime;
        if (j > 1000) {
            this.lastClickTime = currentTimeMillis;
        }
        return !this.clickLimit ? j < 0 : j <= 1000;
    }
}
